package cn.lixu.hystrix;

import cn.lixu.domain.User;
import cn.lixu.feighClient.UserFeighClient;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @author LiXu
 * @date 2022/08/19 0019 16:57:16
 */
@Component
public class UserFeignClientFallbackFactory implements FallbackFactory<UserFeighClient> {

    @Override
    public UserFeighClient create(Throwable throwable) {
        return new UserFeighClient() {
            @Override
            public User getById(Long id) {
                return new User(-1L, "哦豁，你被熔断了", 1,"这是openFeigh集合Hystrix");
            }
        };
    }
}
